package cn.udinghuo.model.archives.serviceterms;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.core.domain.entity.BaseTenantAndDeleted;	
import cn.udinghuo.model.archives.serviceterms.TermsType;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;

/**
 * @author zhaoyt
 *	服务条款
 */
@Entity
@Table(name="serviceterms")
public class ServiceTerms extends BaseTenantAndDeleted<Long>  {

	private static final long serialVersionUID = -1107296257L;
	/**
	* 条款标题title
	*/
	@Comment(value="条款标题")
	@Column(name="cTitle")
	private String title;
	/**
	* 条款类型termsType
	*/
	@Comment(value="条款类型")
	@Column(name="iTermsType")
	private Short termsType;
	/**
	* 是否发布publish
	*/
	@Comment(value="是否发布")
	@Column(name="iPublish")
	private Integer publish;
	/**
	* 条款内容content
	*/
	@Comment(value="条款内容")
	@Lob 
	@Column(name="cContent", length = 20000)
	private String content;
	public String getTitle() {
		return this.title;
	}
	
	public void setTitle(String value) {
		this.title = value;
	}
	
	public TermsType getTermsType() {
        if(this.termsType == null){
			return null;
		}
		return TermsType.find(this.termsType.intValue());
	}
	@JsonSetter
	public void setTermsType(TermsType value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.termsType = value.getValue();
	}
	
	public void setTermsType(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(TermsType.find(value.intValue()),"enum value is invalid value!"); 
		this.termsType = value;
	}
	
	public Integer getPublish() {
		if(this.publish == null){
			return 1;
        }
		return this.publish;
	}
	
	public void setPublish(Integer value) {
		this.publish = value;
	}
	
	public String getContent() {
		return this.content;
	}
	
	public void setContent(String value) {
		this.content = value;
	}
	
}
